const { body } = require('express-validator')

exports.createFolderShema = [
  body('name')
    .custom(name => {
      if (!name) {
        throw new Error('folder name is required')
      }
      return true
    }),
  body('isPrivate')
    .exists()
    .withMessage('isPrivate is required')
    .custom(isPrivate => {
      if (!['0', '1'].includes(isPrivate)) {
        throw new Error('字段 isPrivate 不合法')
      }
      return true
    })
]
